package com.atguigu.r2dbc.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Table;

import java.util.List;

/**
 * @author Jungle
 * @create 2024-01-15 19:03
 */
@Table("t_author")
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
public class Author {
    @Id
    private Long id;
    private String name;
    private Long idNumber;

    // 1-n如何封装
    @Transient  //临时字段，并不是数据库表中的一个字段  等价于 Field(exist=false)
    private List<Book> books;


    public Author(Long id, String name) {
        this.id = id;
        this.name = name;
    }
}
